package model.events

import model.EventTypeEnum
import model.postgresql.PgBaseEvent
import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder}
import zio.json.*

case class Confirmation(
    eventType: EventTypeEnum = EventTypeEnum.ConfirmationType,
    group_id: Long,
    timestamp: Option[Long]
) extends BaseEvent(timestamp = timestamp) {
  override def convertToJson: String                = this.toJson
  override def getUserId: Option[Long]              = None
  override def setTimestamp(ts: Long): Confirmation = copy(timestamp = timestamp)
  override def toPg: Option[PgBaseEvent]            = None
}

object Confirmation {
  given JsonDecoder[Confirmation] = DeriveJsonDecoder.gen[Confirmation]
  given JsonEncoder[Confirmation] = DeriveJsonEncoder.gen[Confirmation]
}
